package com.tancire.system.service.impl;

import java.util.List;
import javax.annotation.Resource;
import com.tancire.common.utils.DateUtils;
import com.tancire.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import com.tancire.system.mapper.SysUserQuickMapper;
import com.tancire.system.domain.SysUserQuick;
import com.tancire.system.service.ISysUserQuickService;

/**
 * 快捷菜单Service业务层处理
 *
 * @author tancire
 * @date 2024-06-15
 */
@Service
public class SysUserQuickServiceImpl implements ISysUserQuickService {
    @Resource
    private SysUserQuickMapper sysUserQuickMapper;

    /**
     * 查询快捷菜单
     *
     * @param id 快捷菜单主键
     * @return 快捷菜单
     */
    @Override
    public SysUserQuick selectSysUserQuickById(Long id) {
        return sysUserQuickMapper.selectSysUserQuickById(id);
    }

    /**
     * 查询快捷菜单列表
     *
     * @param sysUserQuick 快捷菜单
     * @return 快捷菜单
     */
    @Override
    public List<SysUserQuick> selectSysUserQuickList(SysUserQuick sysUserQuick) {
        sysUserQuick.setCreateBy(SecurityUtils.getUserId() + "");
        return sysUserQuickMapper.selectSysUserQuickList(sysUserQuick);
    }

    /**
     * 新增快捷菜单
     *
     * @param sysUserQuick 快捷菜单
     * @return 结果
     */
    @Override
    public int insertSysUserQuick(SysUserQuick sysUserQuick) {
        sysUserQuick.setCreateTime(DateUtils.getNowDate());
        sysUserQuick.setCreateBy(SecurityUtils.getUserId().toString());
        return sysUserQuickMapper.insertSysUserQuick(sysUserQuick);
    }

    /**
     * 修改快捷菜单
     *
     * @param sysUserQuick 快捷菜单
     * @return 结果
     */
    @Override
    public int updateSysUserQuick(SysUserQuick sysUserQuick) {
        sysUserQuick.setUpdateTime(DateUtils.getNowDate());
        return sysUserQuickMapper.updateSysUserQuick(sysUserQuick);
    }

    /**
     * 批量删除快捷菜单
     *
     * @param ids 需要删除的快捷菜单主键
     * @return 结果
     */
    @Override
    public int deleteSysUserQuickByIds(Long[] ids) {
        return sysUserQuickMapper.deleteSysUserQuickByIds(ids);
    }

    /**
     * 删除快捷菜单信息
     *
     * @param id 快捷菜单主键
     * @return 结果
     */
    @Override
    public int deleteSysUserQuickById(Long id) {
        return sysUserQuickMapper.deleteSysUserQuickById(id);
    }

    @Override
    public List<SysUserQuick> selectMineQuickList(SysUserQuick sysUserQuick) {
        sysUserQuick.setCreateBy(SecurityUtils.getUserId() + "");
        return sysUserQuickMapper.selectMineQuickList(sysUserQuick);
    }
}
